package cn.com.guanying.android.ui;

import java.util.ArrayList;

import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.ExpandableListView;
import android.widget.TextView;
import cn.com.guanying.R;
import cn.com.guanying.android.ui.adapter.CinemaAdapter;
import cn.com.guanying.javacore.v11.models.AreaInfo;
import cn.com.guanying.javacore.v11.models.CinemaInfo;

public class CinemaActivity extends BaseActivity implements OnClickListener{
	private ExpandableListView mCinemaList;
	
	public void doInit() {
		CinemaAdapter cinemaAdapter = new CinemaAdapter(this);
		ArrayList<AreaInfo> areas = new ArrayList<AreaInfo>();
		AreaInfo area = new AreaInfo();
		ArrayList<CinemaInfo> cinemas = new ArrayList<CinemaInfo>();
		CinemaInfo cinema = new CinemaInfo();
		cinemas.add(cinema);
		cinemas.add(cinema);
		cinemas.add(cinema);
		area.setmCinemas(cinemas);
		areas.add(area);
		areas.add(area);
		areas.add(area);
		areas.add(area);
		areas.add(area);
		areas.add(area);
		areas.add(area);
		cinemaAdapter.setmCinemas(areas);
		mCinemaList.setAdapter(cinemaAdapter);
		mTitleLeftButton.setText("返回");
		mTitleLeftButton.setOnClickListener(this);
		mTitleContent.setText("武侠");
		mTitleRigthButton.setText("附近");
		mTitleRigthButton.setOnClickListener(this);
	}

	@Override
	public void doFindView() {
		mTitleLeftButton = (Button)findViewById(R.id.left_title_button);
		mTitleContent = (TextView)findViewById(R.id.title_content);
		mTitleRigthButton = (Button)findViewById(R.id.right_title_button);
		mTitleLeftButton.setVisibility(View.VISIBLE);
		mTitleContent.setVisibility(View.VISIBLE);
		mTitleRigthButton.setVisibility(View.VISIBLE);
		mCinemaList = (ExpandableListView)findViewById(R.id.contactListView);
		
	}

	@Override
	protected int getContentView() {
		return R.layout.activity_cinema;
	}
	public void onClick(View v) {
		if(v.getId()==R.id.left_title_button){
			finish();
		}if(v.getId()==R.id.right_title_button){
			Intent intent = new Intent(this,NearbyCinemaActivity.class);
			startActivity(intent);
		}
	}
	@Override
	protected void onLogicEventUI(Object sender, int eventId, Object[] datas) {
		// TODO Auto-generated method stub

	}

}
